package jastgen.generator;

import java.io.PrintWriter;

abstract class AbstractValueVisitorBodyGenerator implements BodyGenerator {

	private final String header;
	private final int n;

	AbstractValueVisitorBodyGenerator(
			final String header,
			final int n)
	{
		this.header = header;
		this.n = n;
	}

	@Override
	public final void generate(final PrintWriter out) {

		out.print(header);
		out.print("<");

		boolean is1st = true;
		for(int i=0; i<n; ++i) {
			if(!is1st) out.print(", ");
			is1st = false;
			out.print("T");
		}

		out.println("> {");
		out.println("}");
	}
}
